import { reqBaseTrademark } from '@/api/tradeMark'

const getDefaultState = () => {
  return {
    trademarkList: {
      records: [],
      total: null,
      size: null,
      current: null,
      searchCount: false,
      pages: null
    }
  }
}

const state = getDefaultState()

const mutations = {
  SETTRADEMARKLIST: (state, data) => {
    state.trademarkList = data
  }
}
const actions = {
  async getTradeMarkList({ commit }, data) {
    const { page, limit } = data
    const result = await reqBaseTrademark(page, limit)
    if (result.code !== 200) return
    commit('SETTRADEMARKLIST', result.data)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
